<?php

require_once(base_ApplicationContext::getInstance()->cfgPath('lib')."cms/isParser.o.inc.php");

class cmsNavConfParser extends isParser
{

  var $null;
  var $tpldata;
  var $hierdepth;
  var $cdata;

  function cmsNavConfParser (&$tpldata)
  {
    $this->tpldata = &$tpldata;
    $this->hierdepth   = 0;
  }

  function startElement($parser, $name, $attrs)
  {
    if ($name=='IS:HIERARCHY')
    {
       $this->hierdepth = $attrs['DEPTH'];
       if (!empty($attrs['PARENTPOS'])) {
           $this->tpldata[$this->hierdepth]['parent']['pos'] = ($attrs['PARENTPOS']=='last'?'last':'first');
       }
    }
    elseif ($name=='IS:SEPARATOR')
    {
       $this->cdata = &$this->tpldata[$this->hierdepth][strtolower($attrs['POS'])];
    }
    elseif ($name=='IS:MENUITEM')
    {
       $this->cdata = &$this->tpldata[$this->hierdepth]['item'][strtolower($attrs['STATE'])];
    }
    elseif ($name=='IS:PARENTITEM')
    {
       $this->cdata = &$this->tpldata[$this->hierdepth]['parent'][strtolower($attrs['STATE'])];
    }
  }

  function finitElement($parser, $name, $attrs)
  {
  }

  function endElement($parser, $name)
  {
     $this->cdata = &$this->null;
     if ($name=='IS:HIERARCHY') $this->hierdepth = 0;
  }

  function cData($parser, $data)
  {
     $this->cdata .= $data;
  }

}

?>
